#!/bin/bash

set -euo pipefail

if [ -z "${GEM_HOST_API_KEY}" ]; then
  echo "GEM_HOST_API_KEY environment variable not found"
  exit
fi

echo "--- Generate an RBI file for inclusion in the gem"
bundle
bundle exec spoom srb sigs export

echo "--- Build and publish gem"

cd $(dirname $0)/..

gem build pdf-reader.gemspec
gem push "pdf-reader-${RELEASE_VERSION}.gem"
